.class public final Lcom/adwhirl/g;
.super Ljava/lang/Object;
.source "AdWhirlManager.java"


# instance fields
.field public a:Ljava/lang/String;

.field b:Ljava/util/Iterator;

.field public c:Ljava/lang/String;

.field public d:Ljava/lang/String;

.field public e:Landroid/location/Location;

.field private f:Lcom/adwhirl/b/b;

.field private g:Ljava/util/List;

.field private h:D

.field private i:Ljava/lang/ref/WeakReference;


# direct methods
.method public constructor <init>(Ljava/lang/ref/WeakReference;Ljava/lang/String;)V
    .locals 3
    .parameter
    .parameter

    .prologue
    .line 74
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 64
    const-wide/16 v0, 0x0

    iput-wide v0, p0, Lcom/adwhirl/g;->h:D

    .line 76
    iput-object p1, p0, Lcom/adwhirl/g;->i:Ljava/lang/ref/WeakReference;

    .line 77
    iput-object p2, p0, Lcom/adwhirl/g;->a:Ljava/lang/String;

    .line 78
    invoke-direct {p0}, Lcom/adwhirl/g;->f()V

    .line 80
    invoke-static {}, Ljava/util/Locale;->getDefault()Ljava/util/Locale;

    move-result-object v0

    invoke-virtual {v0}, Ljava/util/Locale;->toString()Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/adwhirl/g;->c:Ljava/lang/String;

    .line 86
    :try_start_0
    const-string v0, "MD5"

    invoke-static {v0}, Ljava/security/MessageDigest;->getInstance(Ljava/lang/String;)Ljava/security/MessageDigest;

    move-result-object v0

    .line 87
    new-instance v1, Ljava/lang/StringBuffer;

    const-string v2, "android_id"

    invoke-direct {v1, v2}, Ljava/lang/StringBuffer;-><init>(Ljava/lang/String;)V

    .line 88
    const-string v2, "AdWhirl"

    invoke-virtual {v1, v2}, Ljava/lang/StringBuffer;->append(Ljava/lang/String;)Ljava/lang/StringBuffer;

    .line 89
    invoke-virtual {v1}, Ljava/lang/StringBuffer;->toString()Ljava/lang/String;

    move-result-object v1

    invoke-virtual {v1}, Ljava/lang/String;->getBytes()[B

    move-result-object v1

    invoke-virtual {v0, v1}, Ljava/security/MessageDigest;->digest([B)[B

    move-result-object v0

    invoke-static {v0}, Lcom/adwhirl/c/a;->a([B)Ljava/lang/String;

    move-result-object v0

    iput-object v0, p0, Lcom/adwhirl/g;->d:Ljava/lang/String;
    :try_end_0
    .catch Ljava/security/NoSuchAlgorithmException; {:try_start_0 .. :try_end_0} :catch_0

    .line 96
    :goto_0
    return-void

    .line 91
    :catch_0
    move-exception v0

    const-string v0, "00000000000000000000000000000000"

    iput-object v0, p0, Lcom/adwhirl/g;->d:Ljava/lang/String;

    goto :goto_0
.end method

.method private static a(Ljava/io/InputStream;)Ljava/lang/String;
    .locals 5
    .parameter

    .prologue
    const/4 v4, 0x0

    .line 238
    new-instance v0, Ljava/io/BufferedReader;

    new-instance v1, Ljava/io/InputStreamReader;

    invoke-direct {v1, p0}, Ljava/io/InputStreamReader;-><init>(Ljava/io/InputStream;)V

    const/16 v2, 0x2000

    invoke-direct {v0, v1, v2}, Ljava/io/BufferedReader;-><init>(Ljava/io/Reader;I)V

    .line 239
    new-instance v1, Ljava/lang/StringBuilder;

    invoke-direct {v1}, Ljava/lang/StringBuilder;-><init>()V

    .line 243
    :goto_0
    :try_start_0
    invoke-virtual {v0}, Ljava/io/BufferedReader;->readLine()Ljava/lang/String;

    move-result-object v2

    if-eqz v2, :cond_0

    .line 244
    new-instance v3, Ljava/lang/StringBuilder;

    invoke-direct {v3}, Ljava/lang/StringBuilder;-><init>()V

    invoke-virtual {v3, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    const-string v3, "\n"

    invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v2

    invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v2

    invoke-virtual {v1, v2}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;
    :try_end_0
    .catchall {:try_start_0 .. :try_end_0} :catchall_0
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    :catch_0
    move-exception v0

    .line 249
    :try_start_1
    invoke-virtual {p0}, Ljava/io/InputStream;->close()V
    :try_end_1
    .catch Ljava/io/IOException; {:try_start_1 .. :try_end_1} :catch_2

    move-object v0, v4

    .line 260
    :goto_1
    return-object v0

    .line 253
    :cond_0
    :try_start_2
    invoke-virtual {p0}, Ljava/io/InputStream;->close()V
    :try_end_2
    .catch Ljava/io/IOException; {:try_start_2 .. :try_end_2} :catch_1

    .line 260
    invoke-virtual {v1}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v0

    goto :goto_1

    .line 256
    :catch_1
    move-exception v0

    move-object v0, v4

    goto :goto_1

    :catch_2
    move-exception v0

    move-object v0, v4

    goto :goto_1

    .line 252
    :catchall_0
    move-exception v0

    .line 253
    :try_start_3
    invoke-virtual {p0}, Ljava/io/InputStream;->close()V
    :try_end_3
    .catch Ljava/io/IOException; {:try_start_3 .. :try_end_3} :catch_3

    .line 256
    throw v0

    :catch_3
    move-exception v0

    move-object v0, v4

    goto :goto_1
.end method

.method private a(Lorg/json/JSONArray;)V
    .locals 8
    .parameter

    .prologue
    .line 315
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    .line 317
    const-wide/16 v1, 0x0

    iput-wide v1, p0, Lcom/adwhirl/g;->h:D

    .line 321
    const/4 v1, 0x0

    :goto_0
    :try_start_0
    invoke-virtual {p1}, Lorg/json/JSONArray;->length()I

    move-result v2

    if-ge v1, v2, :cond_1

    .line 322
    invoke-virtual {p1, v1}, Lorg/json/JSONArray;->getJSONObject(I)Lorg/json/JSONObject;

    move-result-object v2

    .line 323
    if-eqz v2, :cond_0

    .line 324
    new-instance v3, Lcom/adwhirl/b/c;

    invoke-direct {v3}, Lcom/adwhirl/b/c;-><init>()V

    .line 329
    const-string v4, "nid"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    iput-object v4, v3, Lcom/adwhirl/b/c;->a:Ljava/lang/String;

    .line 330
    const-string v4, "type"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v4

    iput v4, v3, Lcom/adwhirl/b/c;->b:I

    .line 331
    const-string v4, "nname"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    iput-object v4, v3, Lcom/adwhirl/b/c;->c:Ljava/lang/String;

    .line 332
    const-string v4, "weight"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v4

    int-to-double v4, v4

    iput-wide v4, v3, Lcom/adwhirl/b/c;->d:D

    .line 333
    const-string v4, "priority"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v4

    iput v4, v3, Lcom/adwhirl/b/c;->g:I

    .line 335
    iget v4, v3, Lcom/adwhirl/b/c;->b:I

    sparse-switch v4, :sswitch_data_0

    .line 321
    :cond_0
    :goto_1
    add-int/lit8 v1, v1, 0x1

    goto :goto_0

    .line 338
    :sswitch_0
    const-string v4, "key"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v3, Lcom/adwhirl/b/c;->e:Ljava/lang/String;

    .line 376
    :goto_2
    :sswitch_1
    iget-wide v4, p0, Lcom/adwhirl/g;->h:D

    iget-wide v6, v3, Lcom/adwhirl/b/c;->d:D

    add-double/2addr v4, v6

    iput-wide v4, p0, Lcom/adwhirl/g;->h:D

    .line 378
    invoke-interface {v0, v3}, Ljava/util/List;->add(Ljava/lang/Object;)Z
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_1

    :catch_0
    move-exception v1

    .line 386
    :cond_1
    invoke-static {v0}, Ljava/util/Collections;->sort(Ljava/util/List;)V

    .line 388
    iput-object v0, p0, Lcom/adwhirl/g;->g:Ljava/util/List;

    .line 389
    iget-object v0, p0, Lcom/adwhirl/g;->g:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    iput-object v0, p0, Lcom/adwhirl/g;->b:Ljava/util/Iterator;

    .line 390
    return-void

    .line 343
    :sswitch_2
    :try_start_1
    const-string v4, "key"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v3, Lcom/adwhirl/b/c;->e:Ljava/lang/String;

    goto :goto_2

    .line 347
    :sswitch_3
    const-string v4, "key"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v3, Lcom/adwhirl/b/c;->e:Ljava/lang/String;

    goto :goto_2

    .line 351
    :sswitch_4
    const-string v4, "key"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v2

    .line 352
    const-string v4, "siteID"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v4

    iput-object v4, v3, Lcom/adwhirl/b/c;->e:Ljava/lang/String;

    .line 353
    const-string v4, "publisherID"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v3, Lcom/adwhirl/b/c;->f:Ljava/lang/String;

    goto :goto_2

    .line 357
    :sswitch_5
    const-string v4, "key"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v3, Lcom/adwhirl/b/c;->e:Ljava/lang/String;

    goto :goto_2

    .line 367
    :sswitch_6
    const-string v4, "key"

    invoke-virtual {v2, v4}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v3, Lcom/adwhirl/b/c;->e:Ljava/lang/String;
    :try_end_1
    .catch Lorg/json/JSONException; {:try_start_1 .. :try_end_1} :catch_0

    goto :goto_2

    .line 335
    nop

    :sswitch_data_0
    .sparse-switch
        0x1 -> :sswitch_3
        0x6 -> :sswitch_5
        0x8 -> :sswitch_4
        0x9 -> :sswitch_1
        0xe -> :sswitch_0
        0x10 -> :sswitch_1
        0x11 -> :sswitch_6
        0x14 -> :sswitch_2
    .end sparse-switch
.end method

.method private a(Lorg/json/JSONObject;)V
    .locals 3
    .parameter

    .prologue
    .line 286
    new-instance v0, Lcom/adwhirl/b/b;

    invoke-direct {v0}, Lcom/adwhirl/b/b;-><init>()V

    .line 289
    :try_start_0
    const-string v1, "cycle_time"

    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, v0, Lcom/adwhirl/b/b;->i:I

    .line 290
    const-string v1, "location_on"

    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, v0, Lcom/adwhirl/b/b;->j:I

    .line 291
    const-string v1, "transition"

    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v1

    iput v1, v0, Lcom/adwhirl/b/b;->k:I

    .line 295
    const-string v1, "background_color_rgb"

    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v1

    .line 296
    const-string v2, "red"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/b;->e:I

    .line 297
    const-string v2, "green"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/b;->f:I

    .line 298
    const-string v2, "blue"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/b;->g:I

    .line 299
    const-string v2, "alpha"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v1

    mul-int/lit16 v1, v1, 0xff

    iput v1, v0, Lcom/adwhirl/b/b;->h:I

    .line 301
    const-string v1, "text_color_rgb"

    invoke-virtual {p1, v1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v1

    .line 302
    const-string v2, "red"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/b;->a:I

    .line 303
    const-string v2, "green"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/b;->b:I

    .line 304
    const-string v2, "blue"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/b;->c:I

    .line 305
    const-string v2, "alpha"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v1

    mul-int/lit16 v1, v1, 0xff

    iput v1, v0, Lcom/adwhirl/b/b;->d:I
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 311
    :goto_0
    iput-object v0, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    .line 312
    return-void

    .line 307
    :catch_0
    move-exception v1

    goto :goto_0
.end method

.method private b(Ljava/lang/String;)V
    .locals 2
    .parameter

    .prologue
    .line 268
    :try_start_0
    new-instance v0, Lorg/json/JSONObject;

    invoke-direct {v0, p1}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 270
    const-string v1, "extra"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getJSONObject(Ljava/lang/String;)Lorg/json/JSONObject;

    move-result-object v1

    invoke-direct {p0, v1}, Lcom/adwhirl/g;->a(Lorg/json/JSONObject;)V

    .line 271
    const-string v1, "rations"

    invoke-virtual {v0, v1}, Lorg/json/JSONObject;->getJSONArray(Ljava/lang/String;)Lorg/json/JSONArray;

    move-result-object v0

    invoke-direct {p0, v0}, Lcom/adwhirl/g;->a(Lorg/json/JSONArray;)V
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0
    .catch Ljava/lang/NullPointerException; {:try_start_0 .. :try_end_0} :catch_1

    .line 283
    :goto_0
    return-void

    .line 276
    :catch_0
    move-exception v0

    new-instance v0, Lcom/adwhirl/b/b;

    invoke-direct {v0}, Lcom/adwhirl/b/b;-><init>()V

    iput-object v0, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    goto :goto_0

    .line 281
    :catch_1
    move-exception v0

    new-instance v0, Lcom/adwhirl/b/b;

    invoke-direct {v0}, Lcom/adwhirl/b/b;-><init>()V

    iput-object v0, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    goto :goto_0
.end method

.method private static c(Ljava/lang/String;)Lcom/adwhirl/b/a;
    .locals 3
    .parameter

    .prologue
    .line 396
    new-instance v0, Lcom/adwhirl/b/a;

    invoke-direct {v0}, Lcom/adwhirl/b/a;-><init>()V

    .line 398
    :try_start_0
    new-instance v1, Lorg/json/JSONObject;

    invoke-direct {v1, p0}, Lorg/json/JSONObject;-><init>(Ljava/lang/String;)V

    .line 400
    const-string v2, "ad_type"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getInt(Ljava/lang/String;)I

    move-result v2

    iput v2, v0, Lcom/adwhirl/b/a;->a:I

    .line 401
    const-string v2, "img_url"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v0, Lcom/adwhirl/b/a;->d:Ljava/lang/String;

    .line 402
    const-string v2, "redirect_url"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v2

    iput-object v2, v0, Lcom/adwhirl/b/a;->b:Ljava/lang/String;

    .line 403
    const-string v2, "ad_text"

    invoke-virtual {v1, v2}, Lorg/json/JSONObject;->getString(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v1

    iput-object v1, v0, Lcom/adwhirl/b/a;->e:Ljava/lang/String;

    .line 405
    iget-object v1, v0, Lcom/adwhirl/b/a;->d:Ljava/lang/String;

    invoke-static {v1}, Lcom/adwhirl/g;->d(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v1

    iput-object v1, v0, Lcom/adwhirl/b/a;->c:Landroid/graphics/drawable/Drawable;
    :try_end_0
    .catch Lorg/json/JSONException; {:try_start_0 .. :try_end_0} :catch_0

    .line 413
    :goto_0
    return-object v0

    .line 410
    :catch_0
    move-exception v0

    const/4 v0, 0x0

    goto :goto_0
.end method

.method private static d(Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    .locals 1
    .parameter

    .prologue
    .line 418
    :try_start_0
    new-instance v0, Ljava/net/URL;

    invoke-direct {v0, p0}, Ljava/net/URL;-><init>(Ljava/lang/String;)V

    .line 419
    invoke-virtual {v0}, Ljava/net/URL;->getContent()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Ljava/io/InputStream;

    .line 420
    const-string v0, "src"

    invoke-static {p0, v0}, Landroid/graphics/drawable/Drawable;->createFromStream(Ljava/io/InputStream;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;
    :try_end_0
    .catch Ljava/lang/Exception; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    .line 424
    :goto_0
    return-object v0

    :catch_0
    move-exception v0

    const/4 v0, 0x0

    goto :goto_0
.end method

.method private f()V
    .locals 2

    .prologue
    .line 100
    :cond_0
    :goto_0
    iget-object v0, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    if-nez v0, :cond_1

    .line 101
    invoke-virtual {p0}, Lcom/adwhirl/g;->e()V

    .line 102
    iget-object v0, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    if-nez v0, :cond_0

    .line 105
    const-wide/16 v0, 0x7530

    :try_start_0
    invoke-static {v0, v1}, Ljava/lang/Thread;->sleep(J)V
    :try_end_0
    .catch Ljava/lang/InterruptedException; {:try_start_0 .. :try_end_0} :catch_0

    goto :goto_0

    .line 108
    :catch_0
    move-exception v0

    goto :goto_0

    .line 111
    :cond_1
    return-void
.end method

.method private g()Landroid/location/Location;
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 429
    iget-object v0, p0, Lcom/adwhirl/g;->i:Ljava/lang/ref/WeakReference;

    if-nez v0, :cond_0

    move-object v0, v1

    .line 447
    :goto_0
    return-object v0

    .line 433
    :cond_0
    iget-object v0, p0, Lcom/adwhirl/g;->i:Ljava/lang/ref/WeakReference;

    invoke-virtual {v0}, Ljava/lang/ref/WeakReference;->get()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Landroid/content/Context;

    .line 434
    if-nez p0, :cond_1

    move-object v0, v1

    .line 435
    goto :goto_0

    .line 440
    :cond_1
    const-string v0, "android.permission.ACCESS_FINE_LOCATION"

    invoke-virtual {p0, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-nez v0, :cond_2

    .line 441
    const-string v0, "location"

    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Landroid/location/LocationManager;

    .line 442
    const-string v0, "gps"

    invoke-virtual {p0, v0}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;

    move-result-object v0

    goto :goto_0

    .line 443
    :cond_2
    const-string v0, "android.permission.ACCESS_COARSE_LOCATION"

    invoke-virtual {p0, v0}, Landroid/content/Context;->checkCallingOrSelfPermission(Ljava/lang/String;)I

    move-result v0

    if-nez v0, :cond_3

    .line 444
    const-string v0, "location"

    invoke-virtual {p0, v0}, Landroid/content/Context;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Landroid/location/LocationManager;

    .line 445
    const-string v0, "network"

    invoke-virtual {p0, v0}, Landroid/location/LocationManager;->getLastKnownLocation(Ljava/lang/String;)Landroid/location/Location;

    move-result-object v0

    goto :goto_0

    :cond_3
    move-object v0, v1

    goto :goto_0
.end method


# virtual methods
.method public final a(Ljava/lang/String;)Lcom/adwhirl/b/a;
    .locals 10
    .parameter

    .prologue
    const/4 v9, 0x0

    const/4 v8, 0x3

    const/4 v7, 0x2

    const/4 v6, 0x0

    const/4 v5, 0x1

    .line 163
    new-instance v0, Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-direct {v0}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>()V

    .line 166
    iget-object v1, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    iget v1, v1, Lcom/adwhirl/b/b;->j:I

    if-ne v1, v5, :cond_1

    .line 167
    invoke-direct {p0}, Lcom/adwhirl/g;->g()Landroid/location/Location;

    move-result-object v1

    iput-object v1, p0, Lcom/adwhirl/g;->e:Landroid/location/Location;

    .line 168
    iget-object v1, p0, Lcom/adwhirl/g;->e:Landroid/location/Location;

    if-eqz v1, :cond_0

    .line 169
    const-string v1, "&location=%f,%f&location_timestamp=%d"

    new-array v2, v8, [Ljava/lang/Object;

    iget-object v3, p0, Lcom/adwhirl/g;->e:Landroid/location/Location;

    invoke-virtual {v3}, Landroid/location/Location;->getLatitude()D

    move-result-wide v3

    invoke-static {v3, v4}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v3

    aput-object v3, v2, v6

    iget-object v3, p0, Lcom/adwhirl/g;->e:Landroid/location/Location;

    invoke-virtual {v3}, Landroid/location/Location;->getLongitude()D

    move-result-wide v3

    invoke-static {v3, v4}, Ljava/lang/Double;->valueOf(D)Ljava/lang/Double;

    move-result-object v3

    aput-object v3, v2, v5

    iget-object v3, p0, Lcom/adwhirl/g;->e:Landroid/location/Location;

    invoke-virtual {v3}, Landroid/location/Location;->getTime()J

    move-result-wide v3

    invoke-static {v3, v4}, Ljava/lang/Long;->valueOf(J)Ljava/lang/Long;

    move-result-object v3

    aput-object v3, v2, v7

    invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    .line 180
    :goto_0
    const-string v2, "http://cus.adwhirl.com/custom.php?appid=%s&nid=%s&uuid=%s&country_code=%s%s&appver=%d&client=2"

    const/4 v3, 0x6

    new-array v3, v3, [Ljava/lang/Object;

    iget-object v4, p0, Lcom/adwhirl/g;->a:Ljava/lang/String;

    aput-object v4, v3, v6

    aput-object p1, v3, v5

    iget-object v4, p0, Lcom/adwhirl/g;->d:Ljava/lang/String;

    aput-object v4, v3, v7

    iget-object v4, p0, Lcom/adwhirl/g;->c:Ljava/lang/String;

    aput-object v4, v3, v8

    const/4 v4, 0x4

    aput-object v1, v3, v4

    const/4 v1, 0x5

    const/16 v4, 0xfd

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v3, v1

    invoke-static {v2, v3}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    .line 181
    new-instance v2, Lorg/apache/http/client/methods/HttpGet;

    invoke-direct {v2, v1}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V

    .line 185
    :try_start_0
    invoke-interface {v0, v2}, Lorg/apache/http/client/HttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v0

    .line 190
    invoke-interface {v0}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v0

    .line 192
    if-eqz v0, :cond_2

    .line 193
    invoke-interface {v0}, Lorg/apache/http/HttpEntity;->getContent()Ljava/io/InputStream;

    move-result-object v0

    .line 194
    invoke-static {v0}, Lcom/adwhirl/g;->a(Ljava/io/InputStream;)Ljava/lang/String;

    move-result-object v0

    .line 195
    invoke-static {v0}, Lcom/adwhirl/g;->c(Ljava/lang/String;)Lcom/adwhirl/b/a;
    :try_end_0
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v0

    .line 205
    :goto_1
    return-object v0

    .line 172
    :cond_0
    const-string v1, ""

    goto :goto_0

    .line 176
    :cond_1
    iput-object v9, p0, Lcom/adwhirl/g;->e:Landroid/location/Location;

    .line 177
    const-string v1, ""

    goto :goto_0

    :catch_0
    move-exception v0

    :cond_2
    :goto_2
    move-object v0, v9

    .line 205
    goto :goto_1

    .line 203
    :catch_1
    move-exception v0

    goto :goto_2
.end method

.method public final a()Lcom/adwhirl/b/b;
    .locals 4

    .prologue
    .line 114
    iget-wide v0, p0, Lcom/adwhirl/g;->h:D

    const-wide/16 v2, 0x0

    cmpg-double v0, v0, v2

    if-gtz v0, :cond_0

    .line 116
    const/4 v0, 0x0

    .line 119
    :goto_0
    return-object v0

    :cond_0
    iget-object v0, p0, Lcom/adwhirl/g;->f:Lcom/adwhirl/b/b;

    goto :goto_0
.end method

.method public final b()Lcom/adwhirl/b/c;
    .locals 8

    .prologue
    .line 124
    new-instance v0, Ljava/util/Random;

    invoke-direct {v0}, Ljava/util/Random;-><init>()V

    .line 126
    invoke-virtual {v0}, Ljava/util/Random;->nextDouble()D

    move-result-wide v0

    iget-wide v2, p0, Lcom/adwhirl/g;->h:D

    mul-double/2addr v0, v2

    .line 127
    const-wide/16 v2, 0x0

    .line 131
    iget-object v4, p0, Lcom/adwhirl/g;->g:Ljava/util/List;

    invoke-interface {v4}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v4

    .line 132
    const/4 v5, 0x0

    move-object v7, v5

    move-wide v5, v2

    move-object v2, v7

    .line 133
    :goto_0
    invoke-interface {v4}, Ljava/util/Iterator;->hasNext()Z

    move-result v3

    if-eqz v3, :cond_0

    .line 134
    invoke-interface {v4}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lcom/adwhirl/b/c;

    .line 135
    iget-wide v2, p0, Lcom/adwhirl/b/c;->d:D

    add-double/2addr v2, v5

    .line 137
    cmpl-double v5, v2, v0

    if-ltz v5, :cond_1

    move-object v0, p0

    .line 138
    :goto_1
    return-object v0

    :cond_0
    move-object v0, v2

    goto :goto_1

    :cond_1
    move-wide v5, v2

    move-object v2, p0

    goto :goto_0
.end method

.method public final c()Lcom/adwhirl/b/c;
    .locals 2

    .prologue
    const/4 v1, 0x0

    .line 146
    iget-object v0, p0, Lcom/adwhirl/g;->b:Ljava/util/Iterator;

    if-nez v0, :cond_0

    move-object v0, v1

    .line 155
    :goto_0
    return-object v0

    .line 151
    :cond_0
    iget-object v0, p0, Lcom/adwhirl/g;->b:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->hasNext()Z

    move-result v0

    if-eqz v0, :cond_1

    .line 152
    iget-object v0, p0, Lcom/adwhirl/g;->b:Ljava/util/Iterator;

    invoke-interface {v0}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object p0

    check-cast p0, Lcom/adwhirl/b/c;

    move-object v0, p0

    goto :goto_0

    :cond_1
    move-object v0, v1

    goto :goto_0
.end method

.method public final d()V
    .locals 1

    .prologue
    .line 159
    iget-object v0, p0, Lcom/adwhirl/g;->g:Ljava/util/List;

    invoke-interface {v0}, Ljava/util/List;->iterator()Ljava/util/Iterator;

    move-result-object v0

    iput-object v0, p0, Lcom/adwhirl/g;->b:Ljava/util/Iterator;

    .line 160
    return-void
.end method

.method public final e()V
    .locals 5

    .prologue
    .line 209
    new-instance v0, Lorg/apache/http/impl/client/DefaultHttpClient;

    invoke-direct {v0}, Lorg/apache/http/impl/client/DefaultHttpClient;-><init>()V

    .line 211
    const-string v1, "http://mob.adwhirl.com/getInfo.php?appid=%s&appver=%d&client=2"

    const/4 v2, 0x2

    new-array v2, v2, [Ljava/lang/Object;

    const/4 v3, 0x0

    iget-object v4, p0, Lcom/adwhirl/g;->a:Ljava/lang/String;

    aput-object v4, v2, v3

    const/4 v3, 0x1

    const/16 v4, 0xfd

    invoke-static {v4}, Ljava/lang/Integer;->valueOf(I)Ljava/lang/Integer;

    move-result-object v4

    aput-object v4, v2, v3

    invoke-static {v1, v2}, Ljava/lang/String;->format(Ljava/lang/String;[Ljava/lang/Object;)Ljava/lang/String;

    move-result-object v1

    .line 212
    new-instance v2, Lorg/apache/http/client/methods/HttpGet;

    invoke-direct {v2, v1}, Lorg/apache/http/client/methods/HttpGet;-><init>(Ljava/lang/String;)V

    .line 216
    :try_start_0
    invoke-interface {v0, v2}, Lorg/apache/http/client/HttpClient;->execute(Lorg/apache/http/client/methods/HttpUriRequest;)Lorg/apache/http/HttpResponse;

    move-result-object v0

    .line 221
    invoke-interface {v0}, Lorg/apache/http/HttpResponse;->getEntity()Lorg/apache/http/HttpEntity;

    move-result-object v0

    .line 223
    if-eqz v0, :cond_0

    .line 224
    invoke-interface {v0}, Lorg/apache/http/HttpEntity;->getContent()Ljava/io/InputStream;

    move-result-object v0

    .line 225
    invoke-static {v0}, Lcom/adwhirl/g;->a(Ljava/io/InputStream;)Ljava/lang/String;

    move-result-object v0

    .line 226
    invoke-direct {p0, v0}, Lcom/adwhirl/g;->b(Ljava/lang/String;)V
    :try_end_0
    .catch Lorg/apache/http/client/ClientProtocolException; {:try_start_0 .. :try_end_0} :catch_1
    .catch Ljava/io/IOException; {:try_start_0 .. :try_end_0} :catch_0

    .line 235
    :cond_0
    :goto_0
    return-void

    :catch_0
    move-exception v0

    goto :goto_0

    .line 234
    :catch_1
    move-exception v0

    goto :goto_0
.end method
